//  -------------------- iSharePoint -------------------- //
// 
//  Company:	IT Complex, LLC
//  Project:	Smart.Common
//  File name:	FormsContext.cs
//  Developer:	Solomatov Igor
//  Created:	15.04.2012
// 
//  -------------------- iSharePoint -------------------- //

using System;
using System.Collections.Generic;
using Smart.Common.Rules;

namespace Smart.Common.Forms
{
	/// <summary>
	/// Forms context
	/// </summary>
	public class FormsContext
	{
		/// <summary>
		/// Forms service type name
		/// </summary>
		public string ServiceName { get; set; }

		/// <summary>
		/// Forms service
		/// </summary>
		public IFormsService Service { get; set; }

		/// <summary>
		/// Action rules service name
		/// </summary>
		public string ActionRulesServiceName { get; set; }

		/// <summary>
		/// Choose rules service name
		/// </summary>
		public string ChooseRulesServiceName { get; set; }

		/// <summary>
		/// Action rules service
		/// </summary>
		public IRulesService ActionRulesService { get; set; }

		/// <summary>
		/// Choose rules service
		/// </summary>
		public IRulesService ChooseRulesService { get; set; }

		/// <summary>
		/// Form entity (values source)
		/// </summary>
		public IFormEntity Entity { get; set; }

		/// <summary>
		/// Metadata for entity fields
		/// </summary>
		public MetaList Meta { get; set; }

		/// <summary>
		/// Form container
		/// </summary>
		public IFormContainer Container { get; set; }

		/// <summary>
		/// Forms type definition name
		/// </summary>
		public string FormsTypeName { get; set; }

		/// <summary>
		/// All forms
		/// </summary>
		public MetaForms Forms { get; set; }

		/// <summary>
		/// Active form mode
		/// </summary>
		public MetaFormMode Mode { get; set; }

		/// <summary>
		/// Active form
		/// </summary>
		public MetaForm Form { get; set; }

		/// <summary>
		/// Context-defined values
		/// </summary>
		public Dictionary<string, object> Values { get; set; }

		/// <summary>
		/// Forms context
		/// </summary>
		public FormsContext(string serviceName)
		{
			ServiceName = serviceName;

			Values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
		}
	}
}